<template>
  <div>
    <van-nav-bar
      title="收藏列表"
      left-arrow
      @click-left="$router.push('/my')"
    />

    <div class="list" v-show="list.length">
        <van-list
      v-model="loading"
      :finished="finished"
      finished-text="我是有底线的"
      @load="onLoad"
    >
      <HouseItem 
        v-for="item in list " :key="item.houseCode" :item="item"
    ></HouseItem>
    </van-list>
    </div>
  </div>
</template>

<script>
import HouseItem from '@/components/house-item.vue'
import { getCollectList } from '@/api/house'
export default {
  name: 'Collect',
  components:{
    HouseItem
  },
  async created() {
    const res = await getCollectList()
    console.log(res)
   this.list=res.body
  },
  data() {
    return {
      list:[],
      loading: false,
      finished: false,
    }
  },
  methods: {
     async onLoad() {
      // 异步更新数据
     
      this.loading = false

      // 数据全部加载完成
      if (this.list.length >= 20) {
        this.finished = true
      }
    },
  },
}
</script>

<style scoped lang="less"></style>
